#ifndef __BINARYTREE_H_
#define __BINARYTREE_H_

#include <stdbool.h>
#define ElementType void*
struct BinaryTreeNode;
typedef struct BinaryTreeNode BTNode;

//获取节点的值
ElementType GetNodeData(BTNode *n);

struct BinarySortTree;
typedef struct BinarySortTree BSTree;

//初始化二叉树
BSTree *InitBSTree();

//往树中插入一个元素
void InsertElement(BSTree *tree,ElementType element,int(*funcPtr)(ElementType,ElementType));
//前序遍历
void TravelPrev(BSTree *tree,void(*funcPtr)(ElementType));
//中序遍历
void TravelMid(BSTree *tree,void(*funcPtr)(ElementType));
//后序遍历
void TravelPost(BSTree *tree,void(*funcPtr)(ElementType));

//查找树中节点
BTNode *FindByElement(BSTree *tree,ElementType element,int(*funcPtr)(ElementType,ElementType));
//删除一个节点
void RemoveByElement(BSTree *tree,ElementType element,int(*funcPtr)(ElementType,ElementType));
//返回树中节点数量
int GetNodeNumber(BSTree *tree);

<<<<<<< HEAD

void *InsertTree(BSTree *tree,ElementType element,int(*funcPtr)(ElementType,ElementType));
void* DeleteTree(BSTree *tree,ElementType element,int(*funcPtr)(ElementType,ElementType));

=======
>>>>>>> 0979c5004e24bc00a548bec8efd3b8a77e34ab35
#endif